package com.spa.infrastructure.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spa.application.command.massagist.WithdrawApplyCommand;
import com.spa.application.command.massagist.WithdrawApplyNewCommand;
import com.spa.application.dto.PageResult;
import com.spa.application.dto.admin.MessagistWithdrawExportDTO;
import com.spa.application.dto.admin.MessagistWithdrawList4AdminDTO;
import com.spa.application.dto.massagist.MessagistWithdrawListDTO;
import com.spa.application.dto.massagist.MessagistWithdrawProgressDTO;
import com.spa.application.dto.shop.ShopWithdrawAuditListDTO;
import com.spa.application.query.admin.MassagistWithdrawRecordDetailQuery;
import com.spa.application.query.admin.MessagistWithdrawListQuery;
import com.spa.application.query.massagist.MessagistWithdrawQuery;
import com.spa.application.query.massagist.MassagistOrderWithdrawQuery;
import com.spa.application.query.massagist.MessagistWithdrawRecordDetailQuery;
import com.spa.application.query.shop.ShopWithdrawAuditQuery;
import com.spa.domain.entity.MassagistWithdrawRecord;
import com.spa.infrastructure.enums.withdraw.WithdrawStatusEnum;
import com.spa.infrastructure.repository.condition.MassagistWithdrawOrderListCondition;
import com.spa.infrastructure.repository.condition.MassagistWithdrawRecordCondition;
import com.spa.infrastructure.repository.condition.OrderInfoCondition;
import com.spa.infrastructure.repository.po.MassagistWithdrawRecordPO;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
@MapperConfig(unmappedTargetPolicy = ReportingPolicy.WARN)
public interface MassagistWithdrawRecordMapperStruct {

    MassagistWithdrawRecordMapperStruct INSTANCE = Mappers.getMapper(MassagistWithdrawRecordMapperStruct.class);

    MassagistWithdrawRecordPO command2Po(WithdrawApplyCommand command);

    Page<MassagistWithdrawRecord> po2Entity4Page(Page<MassagistWithdrawRecordPO> page);
    List<MassagistWithdrawRecord> po2Entity4List(List<MassagistWithdrawRecordPO> list);

    MassagistWithdrawRecord po2Entity(MassagistWithdrawRecordPO po);

    MassagistWithdrawRecordCondition query2Condition(MessagistWithdrawQuery query);
    MassagistWithdrawRecordCondition query2Condition(MessagistWithdrawListQuery query);
    MassagistWithdrawRecordCondition query2Condition(ShopWithdrawAuditQuery query);

    PageResult<MessagistWithdrawListDTO> entity2MessagistWithdrawListDto4Page(Page<MassagistWithdrawRecord> page);

    PageResult<ShopWithdrawAuditListDTO> entity2ShopWithdrawAuditListDto4Page(Page<MassagistWithdrawRecord> page);
    PageResult<MessagistWithdrawList4AdminDTO> entity2MessagistWithdrawList4AdminDto4Page(Page<MassagistWithdrawRecord> page);

    MessagistWithdrawProgressDTO entity2MessagistWithdrawProgressDto(MassagistWithdrawRecord entity);

    List<MessagistWithdrawExportDTO> entity2MessagistWithdrawExportDto4List(List<MassagistWithdrawRecord> list);

    @Mapping(source = "status",target = "status",qualifiedByName = "int2Str")
    MessagistWithdrawExportDTO entity2MessagistWithdrawExportDto(MassagistWithdrawRecord entity);

    @Named(value = "int2Str")
    default String int2Str(Integer value) {
        return WithdrawStatusEnum.byCode(value).getDesc();
    }

    OrderInfoCondition query2OrderInfoWithdrawCondition(MassagistOrderWithdrawQuery query);

    OrderInfoCondition query2ConditionWithdrawOrderListCondition(MessagistWithdrawRecordDetailQuery query);

    MassagistWithdrawRecordPO commandApply2Po(WithdrawApplyNewCommand command);

    OrderInfoCondition massagistWithdrawRecordDetailQuery2Condition(MassagistWithdrawRecordDetailQuery query);

    OrderInfoCondition messagistWithdrawRecordDetailQuery2OrderInfoCondition(MessagistWithdrawRecordDetailQuery query);
}
